﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Cstudy.DAL
{
    public class postClass
    {
        public bool AddPostClass(MODEL.postclass postclass)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@classname",postclass.CName),
                new SqlParameter("@descscript",postclass.CRemarks),
                new SqlParameter("@classorder",postclass.COrder)
            };
            return COM.SQLHelper.ExecuteNonQuery("sp_AddPostClass", parms);
        }

        public bool UpdatePostClass(MODEL.postclass postclass)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@classid",postclass.CID),
                new SqlParameter("@classname",postclass.CName),
                new SqlParameter("@descscript",postclass.CRemarks),
                new SqlParameter("@classorder",postclass.COrder)
            };
            return COM.SQLHelper.ExecuteNonQuery("sp_UpdatePostClass", parms);
        }

        public bool DeletePostClass(int classid)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@classid",classid)
            };
            return COM.SQLHelper.ExecuteNonQuery("sp_DeletePostClass", parms);
        }

        public DataSet SelectPostClassOrderBy()
        {
            return COM.SQLHelper.ExecuteQuery("sp_SelectPostClassOrderBy");
        }

        public DataSet SelectPostClassByID(int classid)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@classid",classid)
            };
            return COM.SQLHelper.ExecuteQuery("sp_SelectPostClassByID", parms);
        }
    }
}
